package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentColumn;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentColumnService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentColumnController") 
@RequestMapping("/cms/service/content/cmsContentColumn")
public class CmsContentColumnController extends BaseController {

	
	@Autowired
	private ICmsContentColumnService cmsContentColumnService;
	
	@RequiresPermissions(value="cmsContentColumn:loadCmsContentColumnDataSet",desc="内容栏目列表")
    @RequestMapping(value="/loadCmsContentColumnDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentColumnDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentColumnService.loadCmsContentColumnDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentColumn:createCmsContentColumn",desc="内容栏目添加")
    @RequestMapping(value="/createCmsContentColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentColumn(CmsContentColumn cmsContentColumn){
		cmsContentColumnService.createCmsContentColumn(cmsContentColumn);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentColumn:loadCmsContentColumn",desc="内容栏目加载")
    @RequestMapping(value="/loadCmsContentColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentColumn(Long id){
		Optional<CmsContentColumn> ops = cmsContentColumnService.loadCmsContentColumnById(id);
		return ajaxQuery("cmsContentColumn",ops);
    }
	
	@RequiresPermissions(value="cmsContentColumn:updateCmsContentColumn",desc="内容栏目更新")
    @RequestMapping(value="/updateCmsContentColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentColumn(CmsContentColumn cmsContentColumn){
		cmsContentColumnService.updateCmsContentColumn(cmsContentColumn);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentColumn:deletCmsContentColumn",desc="内容栏目删除")
    @RequestMapping(value="/deleteCmsContentColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentColumn(Long id){
		cmsContentColumnService.deleteCmsContentColumn(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}